﻿package Game.Utils {
	
	public class T {
		
		// Constants:
		// Public Properties:
		private static var m_Interface:Object = new Object();
		// Private Properties:
		private static var FLASH_TRACE:Boolean = true;
		private static var DEBUG_TRACE:Boolean = false;
	
		// Initialization:
		public function T() {
			
		}
		public static function setInterface(_interfaceObject:Object):void{
			m_Interface = _interfaceObject;
			DEBUG_TRACE = true;
		}
		// Public Methods:
		public static function Trace(_string:String,_importance:int = 1,_source:String = ""):void{
			//Gestion de la trace dans flash
			
			var importance:String
			if(_importance == 99){
				importance = "(FATAL_ERROR) ";
			}else{
				importance = "("+_importance+") ";
			}
			if(FLASH_TRACE){
				var traceText:String;
				traceText = importance;
				traceText += "["+_source+"]";
				traceText += _string;
				trace(traceText);
			}
			
			//gestion de la trace dans le debug
			var htmlImportance:String= "<div style='text-color:";
			
			if(_importance == 99){
				htmlImportance += "#FF0000";
			}else{
				if(_importance <10){
					htmlImportance += "#0"+_importance+"0000";
				}else{
					htmlImportance += "#"+_importance+"0000";
				}
			}
			htmlImportance+=";font-weight:10;'>"
			htmlImportance+= "<u>"+importance+"</u>";
			
			
			if(DEBUG_TRACE){
				var htmlText:String = htmlImportance;
				htmlText += "<b>";
				htmlText += "["+_source+"]";
				htmlText += "</b>";
				htmlText += _string;
				htmlText += "</div><br/>";
				m_Interface.traceText(htmlText);
			}
			
			
		}
		// Protected Methods:
	}
	
}